//
//  XLBaseTableViewCell.m
//  Current
//
//  Created by 于鹏 on 2017/8/15.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//

#import "XLBaseTableViewCell.h"
#import "XLBaseCellModel.h"
#import "XLAppMacro.h"
@implementation XLBaseTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self setupUI];
}

+ (XLBaseTableViewCell *)cellWithIdentifier:(NSString *)cellIdentifier tableView:(UITableView *)tableView{
    XLBaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[XLBaseTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}

+ (XLBaseTableViewCell *)cellWithIdentifier:(NSString *)cellIdentifier tableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    XLBaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    self.contentView.backgroundColor = kBackground_color;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}


+ (UINib *)xl_nib {
    return [UINib nibWithNibName:NSStringFromClass([self class]) bundle:[NSBundle bundleForClass:[self class]]];
}

- (void)setupDataModel:(XLBaseCellModel *)model {
    _cellModel = model;
}

+ (CGFloat)getCellHeight:(XLBaseCellModel *)model {
    return model.cellHeight;
}

+ (NSString *)identifier {
    return NSStringFromClass([self class]);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
